package com.runda.partypolicy.utils;

import android.os.CountDownTimer;
import android.widget.Button;

/**
 * 复写倒计时
 */

public class MyCountDownTimer extends CountDownTimer {
    private Button btn_djs;
    public MyCountDownTimer(Button button, long millisInFuture, long countDownInterval) {
        super(millisInFuture, countDownInterval);
        this.btn_djs =  button;
    }


    @Override
    public void onTick(long l) {
        //防止计时过程中重复点击
        btn_djs.setClickable(false);
        btn_djs.setText(l/1000+"s");

    }


    /**
     * 复写倒计时
     */
    @Override
    public void onFinish() {
        //重新给Button设置文字
        btn_djs.setText("重新获取");
        //设置可点击
        btn_djs.setClickable(true);
    }
}
